IF EXISTS (SELECT * FROM sysobjects WHERE name = 'SaveSrvrInstncMachine' AND type = 'P')
     DROP PROCEDURE dbo.SaveSrvrInstncMachine
GO

CREATE PROCEDURE dbo.SaveSrvrInstncMachine
     @SrvrInstncId       int,
     @MachineId          int,
     @PackageExecutionId bigint
AS
/*
 *
 * SaveSrvrInstncMachine
 *
 * Purpose:      
 *
 * Inputs:       
 *
 * Assumes:      
 *
 * Effects:      
 *
 * Returns:      
 *
 * Note(s):      
 *
 * CfgCtrl Keys: None
 *
 * Author(s):    NOVA Concepts Ltd.
 *
 * Change Log:   Initial Release, 09/29/2011, 1.00.0000
 *
 */
BEGIN
     SET NOCOUNT ON
     SET XACT_ABORT ON

     -- Check to see if the combination exists, if not insert it.
     IF NOT EXISTS ( SELECT 'X'
                     FROM   dbo.SrvrInstncMachine
                     WHERE  SrvrInstncId = @SrvrInstncId
                     AND    MachineId    = @MachineId )
     BEGIN -- Do the insert.
          INSERT dbo.SrvrInstncMachine 
               ( SrvrInstncId,
                 MachineId,
                 PackageExecutionId )
          SELECT @SrvrInstncId,
                 @MachineId,
                 @PackageExecutionId
     END
END
GO

EXEC sp_addextendedproperty @name = N'MS_Description', @value = 'Save a server instance record tieing a machine record to a server instance record, this represents that the server instance can/has run on that underlying machine.  This sproc is called by SaveSrvrMachineSrvrInstncMachine.', @level0type = N'Schema', @level0name = dbo, @level1type = N'PROCEDURE', @level1name = SaveSrvrInstncMachine;
GO
